package org.example.cet.demos.service.impl;

import org.example.cet.demos.mapper.ScoreMapper;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

@Service
public class ScoreServiceImpl {
    @Autowired
    private ScoreMapper scoreMapper;
    public Object getOverPeopleSum(Integer homeworkId){
        if (homeworkId != 0) {
            return scoreMapper.getOverPeopleSum(homeworkId);
        }
        return null;}

    public Object getAccuracy(Integer shomeworkId, Integer squestionId,Integer xquestionId,Integer questionId,Integer homeworkId){
        if (homeworkId != 0) {
        return scoreMapper.getAccuracy(shomeworkId, squestionId,xquestionId, questionId,homeworkId);
        }
        return null;
    }

    public Object getRightSum(Integer xquestionId,Integer questionId,Integer homeworkId){
        if (homeworkId != 0) {
        return scoreMapper.getRightSum(xquestionId,questionId,homeworkId);
        }
        return null;
    }

    public Object getAverageScore(Integer qtype, Integer homeworkId, Integer type,String classId){
        if (homeworkId != 0) {
        return scoreMapper.getAverageScore(qtype, homeworkId, type, classId);
        }
        return null;
    }

    public Object getScore(Integer homeworkId, String stuId){
        if (homeworkId != 0) {
            return scoreMapper.getScore(homeworkId, stuId);
        }
        return null;
    }

    public Object getRankPeopleSum(Integer score1, Integer score2, Integer homeworkId,Integer type,String classId){
        if (homeworkId != 0) {
        return scoreMapper.getRankPeopleSum(score1, score2, homeworkId, type, classId);
        }
        return null;
    }

}
